<?php

/**
 * sfGuardRegisterForm for registering new users
 *
 * @package    sfDoctrineGuardPlugin
 * @subpackage form
 * @author     Jonathan H. Wage <jonwage@gmail.com>
 * @version    SVN: $Id: BasesfGuardChangeUserPasswordForm.class.php 23536 2009-11-02 21:41:21Z Kris.Wallsmith $
 */
class sfGuardRegisterForm extends BasesfGuardRegisterForm
{
  /**
   * @see sfForm
   */
  public function configure()
  {
    unset(
      $this['last_name'],
      $this['first_name'],
            $this['id'],
            $this['birth_year'],
            $this['sex']
    );
     $this->disableLocalCSRFProtection();

   //$this->useFields(array('username', 'email_address', 'password', 'password_again', 'sex'));  

    $this->setWidget(
            'username', new sfWidgetFormInput(
                array('label'=>'Login: <span class="red">*</span>'), 
                array('size'=>'25')
            ));
    $this->setWidget(
        'email_address', new sfWidgetFormInput(
                array('label'=>'Adres e-mail: <span class="red">*</span>'), 
                array('size'=>'25', 'class' => '')
        
        ));
    $this->setWidget(
            'password', new sfWidgetFormInputPassword(
                array('label'=>'Hasło: <span class="red">*</span>'), 
                array('size'=>'25', 'class' => '')
        ));
    $this->setWidget(
            'password_again', new sfWidgetFormInputPassword(
                array('label'=>'Powtórz hasło: <span class="red">*</span>'), 
                array('size'=>'25', 'class' => '')
                ));
    

    
    /*
    $this->setWidget(
            'regulamin', new sfWidgetFormInputCheckbox(
                array('label' => 'Rejestracja wymaga akceptacji <a href="#">regulaminu</a>'), 
                array('class' => 'regulamin')
       ));
      */  
    $this->setValidators(array(
        'username' => new sfValidatorString(
                array('max_length' => 24, 'required' => true),
                array('max_length' => 'Przekroczona maksymalna ilość znaków', 'required' => 'To pole jest wymagane')
        ),
        'email_address' => new sfValidatorEmail(array('required' => true),array('required' => 'Pole jest wymagane')),
        'password' => new sfValidatorString(
                array('required' => true),
                array('required' => 'Pole jest wymagane')
        ),
 /*       
        'regulamin' => new sfValidatorBoolean(
                array('required' => true),
                array('required' => 'Musisz zaakceptować regulamin!')
        )
  * 
  */
    ));
    $this->validatorSchema['password_again'] = clone
    $this->validatorSchema['password'];
    $this->mergePostValidator(new sfValidatorSchemaCompare(
            'password_again',
            sfValidatorSchemaCompare::EQUAL, 
            'password',   
            array(),
            array('invalid' => 'Hasło wpisane w obu polach powinno być identyczne.', 'required' => 'Pole jest wymagane')));
    
    
    
  }
  
}